#ifndef _TCPSERVER_H
#define _TCPSERVER_H
#include "EventLoop.h"
#include "Acceptor.h"
// 将事件循环和连接封装
class TcpServer
{
public:
    TcpServer(unsigned short port, const string &ip);
    void setAllCallbacks(Callback &&cb1, Callback &&cb2, Callback &&cb3)
    {
        _loop.setAllCallbacks(std::move(cb1),
                              std::move(cb2),
                              std::move(cb3));
    }
    void start();
    void stop();

private:
    Acceptor _acceptor;
    EventLoop _loop;
};

#endif
